<template>
	<view class="beijingse" v-if="pageShow">
		<!-- 规格 -->
		<u-popup :show="show" @close="close">
			<view class="mainpadding">
				<view class="flexbetween">
					<view class="sptp">
						<image class="" :src="dataAll.image_text" @click="lbtpriview(0,[dataAll.image_text])" mode=""></image>
					</view>
					<view class="" style="width: 75%;">
						<view class="titletext xiaohei yhxk">{{dataAll.name}}</view>
						<view class="bigtext fonweight xiaocheng margin_top">¥{{dataAll.price}}</view>
					</view>
				</view>
				<view class="flexbetween margin_top5">
					<view class="ershil fonweight xiaohei ">购买数量</view>
					<u-number-box button-size="36" color="#000000" bgColor="#F7F7F7" iconStyle="color: #fff"
						v-model="buynumber"></u-number-box>
				</view>
				<view class="bigbtn margin_top6" @click="tzqrdd">确定</view>
			</view>
		</u-popup>
		<view class="" style="padding-bottom: 60rpx;">
			<u-swiper :list="dataAll.images_text" @click="lbtpriview($event,dataAll.images_text)" circular height="375px" radius="0"></u-swiper>
			<view class="mainpadding">
				<view class="ffffff radius mainpadding">
					<view class="titletext xiaocheng fonweight">￥
						<text class="xiaocheng fonweight" style="font-size: 48rpx;">{{dataAll.price}}</text>
					</view>
					<view class="titletext xiaohei margin_top">{{dataAll.name}}</view>
					<view class="flexbetween margin_top">
						<view class="titletext xiaohei ">库存{{dataAll.stock}}</view>
						<view class="titletext xiaohei ">销量{{dataAll.sales}}</view>
					</view>
					<view class="margin_top" >
						<u-parse :content="dataAll.des"></u-parse>
					</view>
					<!-- <view class="ershiba xiaohui margin_top">{{dataAll.des}}</view> -->
				</view>
			</view>
			<view class="mainpadding ffffff margin_top" style="padding-bottom: 150rpx;">
				<view class="sanshier textcenter xiaohei">商品详情</view>
				<view class="margin_top">
					<u-parse :content="dataAll.content"></u-parse>
				</view>
			</view>
		</view>
		<!-- 固定底部 -->
		<view class="ffffff mainpadding gudingdb flexbetween">
			<view class="flexleft" style="margin-left: 30rpx;">
				<view class="margin_right5" @click="tzsy">
					<u-icon name="home" color="#333333" size="28"></u-icon>
					<view class="smalltext textcenter xiaohui">首页</view>
				</view>
				<button class="dibubox" hover-class="none" open-type="contact" bindcontact="handleContact" session-from="sessionFrom">
					<view class="">
						<u-icon name="kefu-ermai" color="#333333" size="28"></u-icon>
						<view class="smalltext textcenter xiaohui">客服</view>
					</view>
				</button>
			</view>
			<view class="lbtn flexcenter" @click="show = true">立即购买</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				pageShow:false,
				listid:"",
				dataAll:{},
				buynumber:1,
				buy_type:0,
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.getDetail()
		},
		methods: {
			getDetail() { //获取详情
				httpRequest.request('/api/goodscl/goodsDetail', 'GET', {
					goods_id: this.listid
				}).then(res => {
					this.dataAll = res.data
					this.pageShow = true
				}).catch(err => {})
			},
			close() {
				this.show = false
			},
			// 跳转确认订单
			tzqrdd() {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/wxlogin"
					})
					return false
				}
				let data = {
					data_type: this.dataAll.data_type,//1=医疗,2=礼品
					data: [{
						goods_id: this.listid,
						number: this.buynumber
					}]
				}
				uni.navigateTo({
					url: '/pages_homepage/querendd?msg=' + encodeURIComponent(JSON.stringify(data))
				})
			},
			tzsy() {
				uni.reLaunch({
					url: '/pages/homepage'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.jianbox {
		width: 178rpx;
		height: 48rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		opacity: 1;
		border: 1rpx solid #D2D2D2;
	}

	.biak {
		width: 1rpx;
		height: 47rpx;
		background-color: #D2D2D2;
	}

	.sptp {
		width: 134rpx;
		height: 134rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;

		image {
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			width: 100%;
			height: 100%;
		}
	}

	.lbtn {
		font-size: 26rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
		height: 76rpx;
		background-color: #FF7510;
		width:399rpx;
		border-radius:45rpx;
	}

	.jrbtn {
		font-size: 26rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
		height: 76rpx;
		background-color: #FFB801;
		width: 208rpx;
		border-radius: 45rpx 0 0 45rpx;
	}
</style>